-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Refactors ensure_cuda_torch function to use extracted python and pip commands #3949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
This PR refactors the ensure_cuda_torch function in isaaclab.sh to fix a compatibility issue with UV package manager installations. The changes replace direct parameter passing and hardcoded pip commands with calls to existing helper functions (extract_python_exe(), extract_pip_command(), extract_pip_uninstall_command()) that properly detect and use the appropriate commands for different environments (conda, UV, system python). The version checking logic is also improved by using direct Python imports instead of pip version queries, making it more reliable across different package managers. The contributor has also added their name to the CONTRIBUTORS.md file following project guidelines.
Important Files Changed
| Filename | Score | Overview |
|---|---|---|
| isaaclab.sh | 4/5 | Refactored ensure_cuda_torch function to use helper functions for UV compatibility and improved version checking |
| CONTRIBUTORS.md | 5/5 | Added new contributor "Zijian Li" to the alphabetically sorted list |
Confidence score: 4/5
- This PR addresses a legitimate bug that breaks UV installations and uses well-established helper functions already present in the codebase
- Score reflects solid implementation using existing patterns, though the checklist indicates missing documentation updates and tests for the fix
- Pay close attention to
isaaclab.shto ensure the refactored function works correctly across all supported environments (conda, UV, system python)
Sequence Diagram
sequenceDiagram
participant User
participant Script as "isaaclab.sh"
participant System as "System Commands"
participant Python as "Python/Pip"
participant UV as "UV Package Manager"
User->>Script: "./isaaclab.sh --install"
Script->>Script: "install_system_deps()"
Script->>System: "Check if cmake installed"
System-->>Script: "Status response"
alt cmake not installed
Script->>System: "sudo apt-get install cmake build-essential"
end
Script->>Script: "extract_python_exe()"
Script->>Script: "extract_pip_command()"
Script->>Script: "extract_pip_uninstall_command()"
alt ARM architecture detected
Script->>Script: "begin_arm_install_sandbox()"
Script->>Script: "Unset LD_PRELOAD temporarily"
end
Script->>Script: "ensure_cuda_torch()"
alt UV environment detected
Script->>UV: "uv pip uninstall torch torchvision torchaudio"
UV-->>Script: "Uninstall response"
Script->>UV: "uv pip install torch torchvision"
UV-->>Script: "Install response"
else Standard pip environment
Script->>Python: "python -m pip uninstall torch torchvision torchaudio"
Python-->>Script: "Uninstall response"
Script->>Python: "python -m pip install torch torchvision"
Python-->>Script: "Install response"
end
Script->>Script: "Install isaaclab extensions"
Script->>Python: "Install source directory extensions"
Python-->>Script: "Extension install responses"
Script->>Python: "Install RL frameworks"
Python-->>Script: "Framework install response"
Script->>Script: "ensure_cuda_torch() (verification)"
alt ARM architecture
Script->>Script: "end_arm_install_sandbox()"
Script->>Script: "Restore LD_PRELOAD"
end
alt Not in Docker
Script->>Script: "update_vscode_settings()"
Script->>Python: "Run setup_vscode.py"
Python-->>Script: "VSCode setup response"
end
Script-->>User: "Installation complete"
2 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
This PR refactors the ensure_cuda_torch function in isaaclab.sh to fix UV package manager compatibility issues. The changes replace hardcoded pip commands with standardized helper functions that automatically detect the environment type and use appropriate commands (uv pip for UV environments, pip for standard environments). The refactoring removes the python executable parameter from the function and adds a new extract_pip_uninstall_command() helper function. Additionally, the contributor Zijian Li has been added to the CONTRIBUTORS.md file following the project's alphabetical ordering guidelines.
Important Files Changed
| Filename | Score | Overview |
|---|---|---|
CONTRIBUTORS.md |
5/5 | Adds new contributor "Zijian Li" to the alphabetical list |
isaaclab.sh |
4/5 | Refactors ensure_cuda_torch function to use extracted commands and adds extract_pip_uninstall_command() helper |
Confidence score: 4/5
- This PR is relatively safe to merge with low risk of breaking existing functionality
- Score reflects well-structured changes that follow established patterns, but deducted one point due to changes in critical installation logic that could affect multiple package managers and the lack of comprehensive testing coverage mentioned in the checklist
- Pay close attention to the
isaaclab.shfile, particularly the refactoredensure_cuda_torchfunction and newextract_pip_uninstall_command()helper
2 files reviewed, no comments
Description
Since the latest update in
isaaclab.shbreaks installation with uv, I modifiedensure_cuda_torchto maintain compatiability with uv installation method. Tested on my machine and it worksFixes #3524
Type of change
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there